n = int(input())
tree = {}
for _ in range(n):
    path = input().split('\\')
    current = tree
    for directory in path:
        if directory not in current:
            current[directory] = {}
        current = current[directory]


def print_tree(node, depth=0):
    for key in sorted(node.keys()):
        print(' ' * depth + key)
        print_tree(node[key], depth + 1)


print_tree(tree)